<template>
	<view>
		<block v-if="isHasDataFlag">
			<view class="wrap">
				<view class="rewardItem"
					v-for="(item,index) in list"
					:key="index"
				>
					<view class="taskTit ellip">{{item.taskName}}</view>
					<view class="taskCon">
						<text>+{{item.coin}}</text>
						<text class="iconfont icon-jinbi"></text>
					</view>
				</view>
			</view>
		</block>
		<block v-else-if="isHasDataFlag == false">
			<no-data></no-data>
		</block>
	</view>
</template>

<script>
	import { getTaskRewardList } from '@/api/zhuxue'
	export default {
		data(){
			return{
				studyLogId:0,
				isHasDataFlag:null,
				list:[]
			}
		},
		onLoad(options){
			this.studyLogId = options.studyLogId;
			setTimeout(()=>{
				uni.setNavigationBarTitle({
					title:'[' + options.loreName + ']任务奖励'
				})
			},100);
			this.loadTaskRewardList();
		},
		methods:{
			loadTaskRewardList(){
				var field = { account:uni.getStorageSync('token'),studyLogId:this.studyLogId };
				let contentStr = this.crypto.encrypt(JSON.stringify( field )); 
				getTaskRewardList({content:contentStr}).then(res=>{
					this.isHasDataFlag = true;
					this.list = res.data.datas.studyList;
				}).catch(err=>{
					//console.log(err);
					this.isHasDataFlag = false;
				});
			}
		}
	}
</script>
<style lang="scss">
	page{
		background: $pss-bg-primary;
	}
</style>
<style lang="scss" scoped>
	.wrap{
		background: #fff;
	}
	.rewardItem{
		display: flex;
		align-items: center;
		justify-content: space-between;
		color: $pss-text-color3;
		@include respTo(phone){
			height: 90rpx;
			font-size: $font-size30;
			padding: 0 30rpx;
		}
		@include respTo(pad){
			height: 70rpx;
			font-size: $padSize18;
			padding: 0 20rpx;
		}
		border-bottom: 1rpx solid #eee;
		.taskTit{
			width: 88%;
		}
		.taskCon{
			color: $pss-color-green;
			font-weight: bold;
			@include respTo(phone){
				font-size: $font-size34;
			}
			@include respTo(pad){
				font-size: $padSize26;
			}
			.icon-jinbi{
				font-weight: normal;
				margin-left: 5rpx;
				@include respTo(pad){
					font-size: $padSize20;
				}
			}
		}
	}
</style>